package com.example.Decorator_0;

/**
 * 装饰器模式 example
 * https://www.runoob.com/design-pattern/decorator-pattern.html
 */
public class app {
    public static void main(String[] args) {
        // normal way
        Shape shape = new Circle();
        shape.draw();

        ShapeDecorator sd = new RedShapeDecorator(new Circle());
        sd.draw();

        sd = new RedShapeDecorator(new Rectangle());
        sd.draw();
    }
}
// output:
//     Circle draw.
//     Circle draw.
//     ↑ set red border
//     Rectangle draw.
//     ↑ set red border
